import 'package:custom_widgets/item/item_normal_widget.dart';
import 'package:flutter/material.dart';

import 'theme_demo_dark_page.dart';
import 'theme_demo_light_page.dart';
import 'theme_demo_other_page.dart';
import 'theme_demo_system_page.dart';

class ThemeDemoPage extends StatefulWidget {
  @override
  _ThemeDemoPageState createState() => _ThemeDemoPageState();
}

class _ThemeDemoPageState extends State<ThemeDemoPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("主题 demo"),
        centerTitle: true,
        elevation: 0.0,
      ),
      body: _buildBody(),
    );
  }

  _buildBody() {
    return ListView(
      children: ItemNormalWidget.divideTiles(
        childs: <Widget>[
          ItemNormalWidget.item(
            title: "主题(Light))",
            onTap: () {
              Navigator.push<dynamic>(
                context,
                MaterialPageRoute<dynamic>(
                  builder: (BuildContext context) => ThemeDemoLightPage(),
                ),
              );
            },
          ),
          ItemNormalWidget.item(
            title: "主题(Dark)",
            onTap: () {
              Navigator.push<dynamic>(
                context,
                MaterialPageRoute<dynamic>(
                  builder: (BuildContext context) => ThemeDemoDarkPage(),
                ),
              );
            },
          ),
          ItemNormalWidget.item(
            title: "主题(System)",
            onTap: () {
              Navigator.push<dynamic>(
                context,
                MaterialPageRoute<dynamic>(
                  builder: (BuildContext context) => ThemeDemoSystemPage(),
                ),
              );
            },
          ),
          ItemNormalWidget.item(
            title: "主题(Other)",
            onTap: () {
              Navigator.push<dynamic>(
                context,
                MaterialPageRoute<dynamic>(
                  builder: (BuildContext context) => ThemeDemoOtherPage(),
                ),
              );
            },
          ),
        ],
      ).toList(),
    );
  }
}
